'use strict';

let baseService =require('./baseService.js');

class loginService extends baseService {
   async list(modalJson) {
        const {service,model} = this.ctx;
        modalJson.password=await this.service.tools.md5(modalJson.password);

       console.log(modalJson);
       let listResult=await model.Admin.find(modalJson);

        return listResult
    }
    async doAdd(bodyData) {
        const {service,model} = this.ctx;
        let res=new model.Admin(bodyData)
        let addResult=await res.save();

        return addResult
    }
    async doEdit(editId) {
        const {service,model} = this.ctx;
        let editResult=await model.Admin.find({"_id":editId});

        return editResult
    }
    async findById(findId) {
        const {service,model} = this.ctx;
        let findResult=await model.Admin.find({"_id":findId});

        return findResult
    }
}

module.exports =loginService;

